#ifndef VIRTUALMEM_H
#define VIRTUALMEM_H
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include "copyright.h"
#include "utility.h"
#include "openfile.h"
#include "bitmap.h"
#define BitsInByte 	8
#define BitsInWord 	32
#define NumVMPages 32*16*2
#define PageSize 128
 class VirtualMem
{
   public:
 VirtualMem();
 ~VirtualMem();
//添加功能函数
 int Find();//查找空闲块....
     void Mark(int which);    // Set the "nth" bit
     void Clear(int which); // Clear the "nth" bit
     bool Test(int which);    // Is the "nth" bit set?
     int NumClear();      // Return the number of clear bits
 bool Read(int PageNum,char* buffer);//将页面标号为PageNum的页面读出至buffer
 bool Write(int PageNum,char* buffer);//将buffer写入PageNum页面

  private:
 int fd;
 BitMap* bm;//记录使用情况
 };


#endif

